package com.sskj.spk.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.spk.ui.fragment.MarketListHangqingFragment;
import com.sskj.lib.bean.StockCoinBean;
import com.sskj.lib.http.JsonConverter;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;

/**
 * Created by Lee on 2018/2/28 0028.
 */
public class MarketHangqingFragmentPst extends BasePresenter<MarketListHangqingFragment> {
    public Flowable<List<StockCoinBean>> getData(String code) {
        return httpService.getProduct(code)
                .converter(new JsonConverter<HttpData<List<StockCoinBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(listHttpData -> listHttpData.getData() == null ? new ArrayList<>() : listHttpData.getData());
    }


}
